package com.redpack.redpost.util.Servlet;

import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.redpack.redpost.util.dao.*;
import com.redpack.redpost.util.to.ArchivoArribo;
import com.redpack.redpost.util.to.MultipiezaArriboTo;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class SavePaqueteArribo
 */
public class validaNumPaq extends HttpServlet implements javax.servlet.Servlet{
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public validaNumPaq() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String cve_arribo = "";
		cve_arribo = request.getParameter("cve_arribo");
		int total = 0;
		
		try 
		{
	        
			if(cve_arribo != "")
	  	  	{
				total = MultipiezaArriboDao.validaNumPaq( Integer.parseInt(cve_arribo) );
	  	  	}
	        
		} 
		catch (Exception ex) 
		{
	         ex.printStackTrace();
	         response.getWriter().write(ex.toString());  
	     }
        response.getWriter().write(""+total);  
	}
	
}



